<template >
  <div class="page">
    <div class="hd">
    <h1 class="page_title">金正服务APP</h1>
    </div>
     <cells type="form">
       <input-cell type="text" label="账号"
       :value.sync='account'
       placeholder="请输入账号">
      </input-cell>
       <input-cell type="password" label="密码"
        :password.sync='password'
        placeholder="请输入密码">
      </input-cell>
     </cells>
     <button-area>
      <weui-button type="primary" @click='login'>登陆</weui-button>
      <weui-button type="default">注册</weui-button>
    </button-area>
  </div>
</template>

<script>
import {ButtonArea, Button,CellsTitle,Cells,Cell,InputCell} from 'vue-weui';
import {doLogin} from '../vuex/actions/index'
export default {
  vuex:{
    actions:{
      doLogin
    }
  },
  data: function () {
    return {
      account:'',
      password:''
    }
  },
  computed: {},
  ready: function () {},
  attached: function () {},
  methods: {
    login:function(){
      this.doLogin({
        account:this.account,
        password:this.password
      })
      .then(()=>{
            const redirect = decodeURIComponent(this.$route.query.redirect || '/');
            this.$route.router.go(redirect);
      })
    }
  },
  components: {
    'weui-button': Button,
    ButtonArea,CellsTitle,Cells,Cell,InputCell
  }
}
</script>

<style lang="sass">
</style>
